﻿create table [Partner]
(
	 [PartnerId] int identity(1, 1) primary key
	,[Avatar] nvarchar(128)
	,[PartnerName] nvarchar(128)
	,[Phone] varchar(32)
	,[Email] nvarchar(128)
	,[Fax] nvarchar(32)
	,[ContinentId] int
	,[NationalId] int
	,[CityId] int
	,[DistrictId] int
	,[WardId] int
	,[Address] nvarchar(512)
	,[CreatedDate] datetime
	,[RoleId] int
	,[AuthorId] int
	,[EditorId] int
	,[ApproverId] int
	,[AdminNote] nvarchar(512)
	,[UpdatedBy] int
	,[UpdatedDate] datetime
)
alter table [Partner] add default(getdate()) for [CreatedDate]
go

create table [Hotel]
(
	 [HotelId] int identity(1, 1) primary key
	,[PartnerId] int	
	,[HotelName] nvarchar(128)
	,[HotelSortName] nvarchar(128)
	,[HotelEnglishName] nvarchar(128)
	,[Slug] nvarchar(128)
	,[HotelType] int
	,[Description] nvarchar(256)
	,[Content] nvarchar(max)
	,[Surrogate] nvarchar(128) --Người đại diện
	,[Regency] nvarchar(128) --Chức vụ
	,[CreatedDate] datetime
	,[PublishDate] datetime
	,[RoleId] int
	,[AuthorId] int
	,[EditorId] int
	,[ApproverId] int
	,[AdminNote] nvarchar(512)
	,[UpdatedBy] int
	,[UpdatedDate] datetime
)
alter table [Hotel] add default(getdate()) for [CreatedDate]
go

create table [Room]
(
	 [RoomId] int identity(1, 1) primary key
	,[HotelId] int
	,[RoomName] nvarchar(128)
	,[RoomType] int
	,[Price] decimal
	,[Season] int
	,[TotalPrice] decimal
	,[CreatedDate] datetime
	,[RoleId] int
	,[AuthorId] int
	,[EditorId] int
	,[ApproverId] int
	,[AdminNote] nvarchar(512)
	,[UpdatedBy] int
	,[UpdatedDate] datetime
)
alter table [Room] add default(getdate()) for [CreatedDate]
go

create table [Transportation]
(
	 [TransportationId] int identity(1, 1) primary key
	,[PartnerId] int
	,[TransportationType] nvarchar(128)
	,[Description] nvarchar(128) --Loại ghế, số chỗ ô tô,...
	,[AgreementPrice] decimal --Giá thỏa thuận
	,[ContractPrice] decimal --Giá hợp đồng
	,[SalePrice] decimal --Giá bán
	,[BeginNational] int
	,[BeginCity] int
	,[EndNational] int
	,[EndCity] int
	,[BeginDate] datetime
	,[EndDate] datetime
	,[CreatedDate] datetime
	,[ApplyDate] datetime
	,[RoleId] int
	,[AuthorId] int
	,[EditorId] int
	,[ApproverId] int
	,[AdminNote] nvarchar(512)
	,[UpdatedBy] int
	,[UpdatedDate] datetime
)
alter table [Transportation] add default(getdate()) for [CreatedDate]
go

create table [Restaurant]
(
	 [RestaurantId] int identity(1, 1) primary key
	,[PartnerId] int
	,[RestaurantName] nvarchar(128)
	,[CreatedDate] datetime
	,[RoleId] int
	,[AuthorId] int
	,[EditorId] int
	,[ApproverId] int
	,[AdminNote] nvarchar(512)
	,[UpdatedBy] int
	,[UpdatedDate] datetime
)
alter table [Restaurant] add default(getdate()) for [CreatedDate]
go

create table [Viand]
(
	 [ViandId] int identity(1, 1) primary key
	,[ViandName] nvarchar(128)
	,[Price] decimal
	,[ApplyDate] datetime
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
)
alter table [Viand] add default(getdate()) for [CreatedDate]
go

create table [Menu]
(
	 [MenuId] int identity(1, 1) primary key
	,[RestaurantId] int
	,[MenuName] nvarchar(128)
	,[Viands] varchar(256) --Danh sách món ăn
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
)
alter table [Menu] add default(getdate()) for [CreatedDate]
go

create table [TravelGuide]
(
	 [TravelGuideId] int identity(1, 1) primary key
	,[Avatar] nvarchar(128)
	,[FullName] nvarchar(128)
	,[Birthday] datetime
	,[Gender] nvarchar(8)
	,[Phone] varchar(32)
	,[Email] nvarchar(128)
	,[Info] nvarchar(max)
	,[ContinentId] int
	,[NationalId] int
	,[CityId] int
	,[DistrictId] int
	,[WardId] int
	,[Address] nvarchar(256)
	,[IdentityCard] varchar(64)
	,[Level] int
	,[Languages] varchar(256)
	,[TravelType] nvarchar(128) --Loại tuyến (1 tuyến, suốt tuyến, ...)
	,[Salary] decimal
	,[TotalSalary] decimal
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
)
alter table [TravelGuide] add default(getdate()) for [CreatedDate]
go

create table [Language]
(
	 [LanguageId] int identity(1, 1) primary key
	,[LanguageName] nvarchar(128)
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
)
alter table [Language] add default(getdate()) for [CreatedDate]
go

create table [Service]
(
	 [ServiceId] int identity(1, 1) primary key
	,[ServiceName] nvarchar(128)
	,[ServiceType] nvarchar(128)
	,[SalePrice] decimal
	,[DiscountPrice] int
	,[BeginDate] datetime
	,[EndDate] datetime
	,[Note] nvarchar(512)
	,[CreatedBy] int
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
)
go